# 请在此输入您的代码
import sys

sys.setrecursionlimit(1 << 16)
n, m = map(int, input().split())
m *= 2
melons = list(map(lambda x: int(x) * 2, input().split()))

plans_left = {}
plans_right = {}


def dfs(start_index: int, end_index: int, plans: dict, weights: float, count: int):
    if weights > m: return
    if start_index >= end_index:
        plans[weights] = min(plans.get(weights, float('inf')), count)
        return
    dfs(start_index + 1, end_index, plans, weights + melons[start_index], count)
    dfs(start_index + 1, end_index, plans, weights + melons[start_index] // 2, count + 1)
    dfs(start_index + 1, end_index, plans, weights, count)


dfs(0, n >> 1, plans_left, 0, 0)
dfs(n >> 1, n, plans_right, 0, 0)


def check():
    min_step = float('inf')
    for weight, used_count in plans_left.items():
        if (m - weight) in plans_right:
            min_step = min(min_step, used_count + plans_right[m - weight])
    if min_step == float('inf'):
        return - 1
    else:
        return min_step


print(check())
